<!-- 影片 -->
<template>
  <div class="container">
    <div class="card" style="height:500px;">
      <div class="inner_part">
        <div class="row">
          <div class="col-11 mt-150">
            <div class="player-container pr-30 border-radius-10">
              <transition :name="changeModule">
                <vue-core-video-player style="height:450px; width:750px;" :autoplay="false" :src="vedio[currentIndex]" v-show="change">
                </vue-core-video-player>
              </transition>
            </div>
          </div>
          <div class="col-1 mt-180" v-if="change">
            <div class="mt-80 ml-30">
              <a href="javascript:void(0)" @click="next(-1)"><i class="fa fa-angle-up"></i></a>
            </div>
            <div class="mt-200 ml-30">
              <a href="javascript:void(0)" @click="next(1)"><i class="fa fa-angle-down"></i></a>
            </div>
          </div>
        </div>

      </div>

    </div>
  </div>

</template>

<script>
  //这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
  //例如：import 《组件名称》 from '《组件路径》';
  import bus from '../../utils/bus.js'
  export default {
    //import引入的组件需要注入到对象中才能使用
    components: {},
    props: ['vedio'],
    data() {
      //这里存放数据
      return {
        currentIndex: 0,
        change: true,
        changeModule:'',
      };
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {
      async next(val) {
        if (val<0) {
          this.changeModule = 'el-zoom-in-top';
        } else {
          this.changeModule = 'el-zoom-in-bottom';
        }
        this.change = false;
        this.currentIndex += val;
        if (this.currentIndex == this.vedio.length) {
          this.currentIndex = 0;
        } else if (this.currentIndex == -1) {
          this.currentIndex = this.vedio.length - 1;
        }
        const vd = {
          path:this.vedio[this.currentIndex],
          idx:this.currentIndex
        }
        const parm = {
          name: 'vedio',
          data: vd
        }
        bus.$emit('loadComment', parm);
        await setTimeout(this.changeTrue, 300);

      },
      changeTrue() {
        this.change = true;
      }

    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {

    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {

    },
    beforeCreate() {}, //生命周期 - 创建之前
    beforeMount() {}, //生命周期 - 挂载之前
    beforeUpdate() {}, //生命周期 - 更新之前
    updated() {}, //生命周期 - 更新之后
    beforeDestroy() {}, //生命周期 - 销毁之前
    destroyed() {}, //生命周期 - 销毁完成
    activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
  }

</script>
<style scoped>
  .vjs-custom-skin>.video-js .vjs-big-play-button {
    background-color: rgba(0, 0, 0, 0.45);
    font-size: 3.5em;
    border-radius: 50%;
    height: 2em !important;
    line-height: 2em !important;
    margin-top: -1em !important;
    margin-left: -1em !important;
    width: 2em !important;
    outline: none;
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html,
  body {
    height: 100vh;
    font-family: 'Open Sans', sans-serif;
  }

  body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #cecece;
  }

  .container {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .card {
    position: absolute;
    height: 350px;
    width: 100%;
    max-width: 850px;
    margin: auto;
    background: #ffffff;
    border-radius: 25px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
  }

  .card .inner_part {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 0 30px;
    height: 350px;
    position: absolute;
  }

  #slideImg:checked~.inner_part {
    padding: 0;
    transition: .1s ease-in;
  }

  .inner_part .img {
    height: 260px;
    width: 260px;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
  }

  #slideImg:checked~.inner_part .img {
    height: 350px;
    width: 850px;
    z-index: 99;
    transition: .3s .2s ease-in;
  }

  .img img {
    height: 100%;
    width: 100%;
    cursor: pointer;
    opacity: 0;
    transition: .6s;
  }

  #slide_1:checked~.inner_part .img_1,
  #slide_2:checked~.inner_part .img_2,
  #slide_3:checked~.inner_part .img_3 {
    opacity: 1;
    transition-delay: .2s;
  }

  .content {
    padding: 0 20px 0 35px;
    width: 530px;
    margin-left: 50px;
    opacity: 0;
    transition: .6s;
  }

  #slideImg:checked~.inner_part .content {
    display: none;
  }

  #slide_1:checked~.inner_part .content_1,
  #slide_2:checked~.inner_part .content_2,
  #slide_3:checked~.inner_part .content_3 {
    opacity: 1;
    margin-left: 0;
    z-index: 100;
    transition-delay: .3s;
  }

  .content .title {
    font-size: 30px;
    font-weight: 700;
    color: #0d0925;
    margin: 0 0 20px 0;
  }

  .content .text {
    font-size: 19px;
    color: #4e4a67;
    margin: 0 auto 30px auto;
    line-height: 1.5em;
    text-align: justify;
  }

  .content button {
    padding: 15px 20px;
    border: none;
    font-size: 16px;
    color: #fff0e6;
    font-weight: 600;
    letter-spacing: 1px;
    border-radius: 50px;
    cursor: pointer;
    outline: none;
    background: #000000;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    float: right;
  }

  .content button:hover {
    background: #cecece;
    color: #000000;
  }

  .slider {
    position: absolute;
    bottom: 25px;
    left: 55%;
    transform: translateX(-50%);
    z-index: 1;
  }

  #slideImg:checked~.slider {
    display: none;
  }

  .slider .slide {
    position: relative;
    height: 10px;
    width: 50px;
    background: #d9d9d9;
    border-radius: 5px;
    display: inline-flex;
    margin: 0 3px;
    cursor: pointer;
  }


  .slider .slide:before {
    position: absolute;
    content: '';
    top: 0;
    left: 0;
    height: 100%;
    width: -100%;
    background: #000000;
    ;
    border-radius: 10px;
    transform: scaleX(0);
    transition: transform .6s;
    transform-origin: left;
  }

  #slide_1:checked~.slider .slide_1:before,
  #slide_2:checked~.slider .slide_2:before,
  #slide_3:checked~.slider .slide_3:before {
    transform: scaleX(1);
    width: 100%;
  }

  input {
    display: none;
  }

</style>
